<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>凯盛项目管理系统</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />

  </head>
  
  <body>
    <%@ include file= "top.jsp" %>
    <div class="container">
		<div class="row">
			<div class="span3">
				<div class="well" style="padding: 8px 0;margin-top:80px;" >
					<ul class="nav nav-list">
						<li class="nav-header">${sessionScope.pu.project.name }</li>
						<li>${sessionScope.user.username }:${sessionScope.pu.role }</li>
						<li class="divider">c</li>
						<li><a href="project.jspx?id=${sessionScope.pu.projectid }"><i class="icon-home"></i>最新动态</a></li>
						<li><a href="goal.jspx"><i class="icon-flag"></i>目标</a></li>
						<li><a href="document.jspx"><i class="icon-folder-open"></i>资料库</a></li>
						<li class="active"><a href="file.jspx"><i class="icon-file icon-white"></i>文件共享</a></li>
						<li><a href="contact.jspx"><i class="icon-user"></i>联系人</a></li>
						<li><a href="idea.jspx"><i class="icon-fire"></i>想法</a></li>
						<li><a href="#"><i class="icon-warning-sign"></i>Bug</a></li>
						<li><a href="main.jspx?m=editProject&id=${pu.projectid }"><i class="icon-cog"></i>项目设置</a></li>
					</ul>
				</div>
			</div>
			<div class="span9" style="margin-top:80px;">
				<form enctype="multipart/form-data" method="post" id="myform" class="form-horizontal" action="file.jspx?m=upload" >
					<fieldset>
						<legend>分享新文件</legend>
						<c:choose>
							<c:when test="${param.code == 10001 }">
								<div style="color:red;font-size:18px">文件太大请重新选择</div>
							</c:when>
							<c:when test="${param.code == 10002 }">
								<div style="color:red;font-size:18px">该文件已存在请重新选择</div>
							</c:when>
						</c:choose><br>
						<div class="control-group">
							<label  class="control-label" >文件名称</label>
							<div class="controls">
								<input type="text" name="name" style="height: 28px;" class="span5">
							</div>
						</div>
						<div class="control-group">
							<div class="controls">
								<input type="file" name="files" id="files" class="span5" />
								<span style="color:red" id="files-msg"></span><br/>
							</div>
						</div>
						<div class="form-actions">
							<button type="button" id="btnSubmit" class="btn btn-primary">上传</button>
							<a class="btn" href="file.jspx?m=upload">重置</a>
							
						</div>
					</fieldset>
				</form>				
			</div>
		</div>
	</div>
	<script type="text/javascript">
		function validateFile() {
			var files = document.getElementById("files").value;
			if(files.trim().length == 0) {
				return false;
			}
			return true;
		}	
		document.getElementById("btnSubmit").onclick = function() { 		
    		var result = validateFile();		
			if(!result) {
			   
				document.getElementById("files-msg").innerHTML = "×您还未选择上传的文件";
			} else {
				
				document.getElementById("myform").submit();
			}
    	};
	</script>
  </body>
</html>
